package com.winit.openapi.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import com.winit.common.query.Page;
import com.winit.common.query.SearchOperator;
import com.winit.common.query.Searchable;
import com.winit.common.query.Sort;
import com.winit.common.query.filter.SearchFilterHelper;
import com.winit.common.utils.JsonMapper;
import com.winit.openapi.util.ValidateUtil;
import com.winit.ums.spi.commnad.ConsigneeAddressCommand;
import com.winit.ums.spi.customer.PlatformAccountService;
import com.winit.ums.spi.customer.command.CheckCustomerVSAccountIdCommand;
import com.winit.ums.spi.customer.command.QueryCustomerVSAccountIdByCodeCommand;
import com.winit.ums.spi.customer.vo.PlatformAccountVo;
import com.winit.ums.spi.customer.vo.TeapplixVAccountVo;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.winit.common.spi.context.CommandContext;
import com.winit.erp.spi.bpartner.BpartnerService;
import com.winit.erp.spi.bpartner.ContractService;
import com.winit.erp.spi.bpartner.command.BpartnerCommand;
import com.winit.erp.spi.bpartner.command.ContractCommand;
import com.winit.erp.spi.bpartner.vo.Bpartner;
import com.winit.erp.spi.user.UserService;
import com.winit.erp.spi.user.command.UserCommand;
import com.winit.erp.spi.user.vo.User;
import com.winit.openapi.constants.ApiConstant;
import com.winit.openapi.constants.ErrorCode;
import com.winit.openapi.exception.ApiException;
import com.winit.openapi.model.RequestMsg;
import com.winit.openapi.model.ResponseMsg;
import com.winit.ums.spi.UmsCustomerService;
import com.winit.ums.spi.UmsUserService;
import com.winit.ums.spi.commnad.customer.ApplyForChangePasswordCommand;
import com.winit.ums.spi.commnad.customer.GetContractStatusCommand;
import com.winit.ums.spi.commnad.customer.ModifyUserPasswordByVerificationCodeCommand;
import com.winit.ums.spi.commnad.customer.QueryCompanylCommand;
import com.winit.ums.spi.common.CustomerConstant;
import com.winit.ums.spi.customer.CustomerUsService;
import com.winit.ums.spi.customer.command.ActivationCustomerStatusCommand;
import com.winit.ums.spi.user.command.QueryTokenCommand;
import com.winit.ums.spi.vo.CustomerInfoVO;
import com.winit.ums.spi.vo.CustomerUsVo;
import com.winit.ups.spi.sys.CustomerTansferConfigService;
import com.winit.ups.spi.sys.command.CustomerTansferConfigPkCommand;
import com.winit.ups.spi.sys.vo.CustomerTansferConfigVo;


/**
 * 用户基本信息 TODO long.yue: Change to the actual description of this class
 * 
 * @version Revision History
 * 
 * <pre>
 * Author     Version       Date        Changes
 * long.yue    1.0           2015年1月8日     Created
 * 
 * </pre>
 * @since 1.
 */
@Controller
@RequestMapping(value = "/user")
public class UserController extends BaseController {

    private static Logger           logger = LoggerFactory.getLogger(UserController.class);
	
    @Resource
    private UserService     userService;

    @Resource
    private ContractService agreementService;
    
    @Resource
    private CustomerUsService customerUsService;
    
    @Resource
    private BpartnerService bpartnerService;
    
    @Resource
    private UmsCustomerService umsCustomerService;
    
    @Resource
    private UmsUserService umsUserService;
    
    @Resource
    private CustomerTansferConfigService customerTansferConfigService;

    @Resource
    private PlatformAccountService platformAccountService;
    
    //userName
    private static final String USER_NAME="userName";
    //3：接口注册  1：网站注册  2：手动添加
    private static final String DATA_SOURCE="3";
    //状态：初始化
    private static final String INIT_STATUS="init";
    private static final Integer ORGANIZATION_ID_VALUE=1000088;
    

    public void setAgreementService(ContractService agreementService) {
        this.agreementService = agreementService;
    }

    public void setUserService(UserService userService) {
        this.userService = userService;
    }

    /**
     * 检查用户业务权限 TODO Add comments here.
     * 
     * @param requestMsg
     * @param responseMsg
     * @return
     */
    @RequestMapping(value = "/agreementRight/query")
    public String checkUserRight(@ModelAttribute RequestMsg requestMsg, @ModelAttribute ResponseMsg responseMsg) {
        // 获取参数
        JSONObject json = JSONObject.parseObject(requestMsg.getData().toString());
        String busiType = null;
        String userId = CommandContext.getContext().getUserId();
        BpartnerCommand bpartnerCommand = new BpartnerCommand();
        bpartnerCommand.setcBpartnerId(Long.valueOf(userId));
        Bpartner bpartner = bpartnerService.queryBpartnerById(bpartnerCommand);
        if (bpartner == null) {
            logger.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>bpartner对象为空");
            return ERROR;
        }
        if (json.containsKey(ApiConstant.BUSI_TYPE)) {
            busiType = json.getString(ApiConstant.BUSI_TYPE);
        } else {
            throw new ApiException(ErrorCode.FIELD_NOT_NULL, ApiConstant.BUSI_TYPE);
        }
        if(busiType == null || StringUtils.equals("", busiType)){
        	throw new ApiException(ErrorCode.FIELD_NOT_NULL, ApiConstant.BUSI_TYPE);
        }
        String busiTypes[] = busiType.split(":");
        Map<String, Boolean> r1 = new HashMap<String, Boolean>();
        for (String busiTypeValue : busiTypes) {
        	boolean rightStatus = false;
        	GetContractStatusCommand statusCommand = JSON.parseObject(requestMsg.getData().toString(), GetContractStatusCommand.class);
        	if(CustomerConstant.ErpServicesCode.OUTBOUND.getVal().equals(busiTypeValue)){
        	    //检查是否有海外仓权限
                statusCommand.setServiceType(CustomerConstant.ServiceType.OWHS.toString());                                
	        }else if(CustomerConstant.ErpServicesCode.CBTR.getVal().equals(busiTypeValue)){
	            //检查是否有退货权限
	            statusCommand.setServiceType(CustomerConstant.ServiceType.CBTR.toString());            
	        }else if(CustomerConstant.ErpServicesCode.ISP.getVal().equals(busiTypeValue)){	            
	            //检查是否有ISP权限
                statusCommand.setServiceType(CustomerConstant.ServiceType.ISP.toString());
	        }
        	rightStatus = umsCustomerService.isOpenContract(statusCommand);
        	r1.put(busiTypeValue, rightStatus);
		}
        responseMsg.setData(r1);
        return SUCCESS;
    }

    /**
     * 获取token
     * 
     * @param requestMsg
     * @param responseMsg
     * @return
     */
    @RequestMapping(value = "/getToken")
    public String getToken(@ModelAttribute RequestMsg requestMsg, @ModelAttribute ResponseMsg responseMsg) {
        // 获取参数
        JSONObject json = JSONObject.parseObject(requestMsg.getData().toString());
        String userName = null;
        String passWord = null;
        if (json.containsKey("userName")) {
            userName = json.getString("userName");
        }
        if (json.containsKey("passWord")) {
            passWord = json.getString("passWord");
        }

        QueryTokenCommand queryTokenCommand = new QueryTokenCommand();
        queryTokenCommand.setUserName(userName);
        queryTokenCommand.setPassword(passWord);
        String token = umsUserService.getToken(queryTokenCommand);

        // 返回token
        if (token != null) {
            Map<String, String> data = new HashMap<String, String>();
            data.put("token", token);
            responseMsg.setData(data);
        } else {
            throw new ApiException(ErrorCode.USERNAME_OR_PASSWORD_INVALID);
        }

        return SUCCESS;
    }
    
    /**
     * 用户登录 login
     * 
     * @param requestMsg
     * @param responseMsg
     * @return
     */
    @RequestMapping(value = "/login")
    public String login(@ModelAttribute RequestMsg requestMsg, @ModelAttribute ResponseMsg responseMsg) {
        
        Map<String, Object> returnMapData = new HashMap<String, Object>();
        
        JSONObject json = JSONObject.parseObject(requestMsg.getData().toString());
        
        //1.检测是否为美国卖家
        activationCustomerStatus(json,returnMapData);
        
        //2.验证登录，获取用户ID
        validUser(json,returnMapData);
        
        //3.获取API Token
        //4.获取OpenAPI Token
        getOpenApiToken(json,returnMapData);
        
        //5.是否开通ISP服务
        checkUserISPService(json,returnMapData);
        
        //6.获取度量单位
        getMeasurementSystem(json,returnMapData);
        
        /*//7.获取客户迁移配置的仓库
        getCustomerTansferConfig(json,returnMapData);*/
        
        //设置返回参数
        responseMsg.setData(returnMapData);
        
        return SUCCESS;
    }
    
    /**
     * 卖家登陆时检测 卖家账号是否激活
     */
    private void activationCustomerStatus(JSONObject json, Map<String, Object> returnMapData)
    {
        ActivationCustomerStatusCommand command= new ActivationCustomerStatusCommand();
        if (json.containsKey("userName")) {
            command.setUserName(json.getString("userName"));
        }else {
            throw new ApiException(ErrorCode.FIELD_NOT_NULL, USER_NAME);
        }
        /*if (json.containsKey("organizationId")) {
            command.setOrganizationId(json.getInteger("organizationId"));
        }else {
            throw new ApiException(ErrorCode.FIELD_NOT_NULL, ORGANIZATION_ID);
        }*/
        if (json.containsKey("passWord")) {
            command.setPassWord(json.getString("passWord"));
        }else {
            throw new ApiException(ErrorCode.FIELD_NOT_NULL, "passWord");
        }
        command.setCtx(CommandContext.getContext());
        CustomerUsVo customerUsVo = customerUsService.queryUser(command);
   
        boolean isActivation=true; //是否激活
        boolean isUsaUser=true;//是否US组织用户
        //Map<String, Boolean> returnMapDate = new HashMap<String, Boolean>();
        if (customerUsVo.getUserName() == null) {
            isActivation = false;
            isUsaUser = false;
        } else {
            if (!DATA_SOURCE.equals(customerUsVo.getDataSource())) {
                // 不是通过接口注册的用户
                isUsaUser = false;
            }
            if (INIT_STATUS.equals(customerUsVo.getStatus())) {
                isActivation = false;
            }
            if(!String.valueOf(ORGANIZATION_ID_VALUE).equals(String.valueOf(customerUsVo.getOrganizationId()))){
                isUsaUser = false;
            }
        }
        returnMapData.put("isActivation", isActivation);
        returnMapData.put("isUsaUser", isUsaUser);
    }
    
    /**
     * 
     * 检查用户业务是否有ISP权限
     * @param json
     * @param returnMapData
     */
    private void checkUserISPService(JSONObject json, Map<String, Object> returnMapData) {
        
        String busiType = null;
        if (json.containsKey(ApiConstant.BUSI_TYPE)) {
            busiType = json.getString(ApiConstant.BUSI_TYPE);
        } else {
            throw new ApiException(ErrorCode.FIELD_NOT_NULL, ApiConstant.BUSI_TYPE);
        }
        ContractCommand command = new ContractCommand();
        command.setBusiType(busiType);
        command.setBpartnerId(Long.parseLong(CommandContext.getContext().getUserId()));
        boolean rightStatus = agreementService.isOpenContract(command);
        returnMapData.put("status", rightStatus);
    }
    
    /**
     * 获取度量单位
     * @param json
     * @param returnMapData
     */
    private void getMeasurementSystem(JSONObject json, Map<String, Object> returnMapData) {
        BpartnerCommand command = new BpartnerCommand();
        CommandContext ctx = CommandContext.getContext();
        Long cBpartnerId = Long.valueOf(ctx.getUserId());
        command.setcBpartnerId(cBpartnerId);
        Bpartner bpartner = bpartnerService.queryBpartnerById(command);
        if (null != bpartner) {
            String measurementSystem = bpartner.getMeasurementSystem();
            returnMapData.put("measurementSystem", measurementSystem);
            returnMapData.put("customerCode", bpartner.getValue());
        }
    }
    
    /**
     * 获取OpenAPI Token
     * @param json
     * @param returnMapData
     */
    private void getOpenApiToken(JSONObject json, Map<String, Object> returnMapData) {
        String userName = null;
        String passWord = null;
        if (json.containsKey("userName")) {
            userName = json.getString("userName");
        }
        if (json.containsKey("passWord")) {
            passWord = json.getString("passWord");
        }

        // 验证用户名密码
        UserCommand userCommand = new UserCommand();
        userCommand.setLoginName(userName);
        userCommand.setPassword(passWord);
        String login = userService.login(userCommand);

        // 返回token
        if (login != null) {
            User user = userService.getUser(userCommand);
            if (user!= null) {
                returnMapData.put("token", user.getToken());
            } else {
                throw new ApiException(ErrorCode.USERNAME_OR_PASSWORD_INVALID);
            }
        } else {
            throw new ApiException(ErrorCode.USERNAME_OR_PASSWORD_INVALID);
        }
    }
    
    /**
     * 获取OpenAPI Token
     * @param json
     * @param returnMapData
     */
    private void validUser(JSONObject json, Map<String, Object> returnMapData) {
        String userName = null;
        if (json.containsKey("userName")) {
            userName = json.getString("userName");
        }

        // 验证用户名密码
        UserCommand userCommand = new UserCommand();
        userCommand.setLoginName(userName);
        // 返回user
        User user = userService.getUser(userCommand);
        if (user!= null) {
            returnMapData.put("AD_user_ID", user.getUserId());
            returnMapData.put("passWord", user.getPassword());
            returnMapData.put("userName", user.getLoginName());
            returnMapData.put("C_bpartner_ID", user.getBpartnerId()); 
            returnMapData.put("IsActive", user.getIsActive()); 
            returnMapData.put("Updated", user.getUpdated()); 
        } else {
            throw new ApiException(ErrorCode.USER_NOT_FOUND);
        }    
    }
    
    /**
     * 获取客户迁移配置仓库
     * @param json
     * @param returnMapData
     */
    @RequestMapping(value = "/getCustomerTansferConfig")
    public String getCustomerTansferConfig(@ModelAttribute RequestMsg requestMsg, @ModelAttribute ResponseMsg responseMsg){
        String userName = CommandContext.getContext().getUsername();
        QueryCompanylCommand command =  new QueryCompanylCommand();
        command.setEmail(userName);
        CustomerInfoVO customerVo = umsCustomerService.queryCompanyByUserName(command);
        List<CustomerTansferConfigVo> vos = null;
        if(customerVo != null && StringUtils.isNotBlank(customerVo.getCode())){
            CustomerTansferConfigPkCommand pkCommand = new CustomerTansferConfigPkCommand();
            pkCommand.setCustomerCode(customerVo.getCode());
            pkCommand.setIsActive("Y");
            vos = customerTansferConfigService.queryCustomerTansferConfigs(pkCommand);
        }
        Map<String,Object> map = new HashMap<String, Object>();
        map.put("CustomerTansferConfigs", vos);
        responseMsg.setData(map);
        return SUCCESS;
    }
    
    /**
     * 获取BpartenerValue
     * 
     * @param requestMsg
     * @param responseMsg
     * @return
     */
    @RequestMapping(value = "/getBpartenerValue")
    public String getBpartenerValue(@ModelAttribute RequestMsg requestMsg, @ModelAttribute ResponseMsg responseMsg) {
        // 获取App_key
        String userName = requestMsg.getApp_key();
            
        // 验证用户名
        UserCommand userCommand = new UserCommand();
        userCommand.setLoginName(userName);
        
        User user = userService.getUser(userCommand);
        
        BpartnerCommand bpartnerCommand = new BpartnerCommand();
        Map<String, String> data = new HashMap<String, String>();
        if(user!= null){
            bpartnerCommand.setcBpartnerId(user.getBpartnerId());
            // 返回bpartner
            Bpartner bpartner = bpartnerService.queryBpartnerById(bpartnerCommand);
            if (null != bpartner) {
                data.put("bpartenerValue", bpartner.getValue());
            }
            responseMsg.setData(data);
        } else {
            throw new ApiException(ErrorCode.USER_NOT_FOUND);
        }

        return SUCCESS;
    }
    
    /**
     * 用户自主申请修改密码
     * 
     * @param requestMsg
     * @param responseMsg
     * @return String
     */
    @RequestMapping(value = "/applyForChangePassword")
    public String applyForChangePassword(@ModelAttribute RequestMsg requestMsg, @ModelAttribute ResponseMsg responseMsg) {
    	ApplyForChangePasswordCommand command = JSON.parseObject(requestMsg.getData().toString(), ApplyForChangePasswordCommand.class);
        command.setCtx(CommandContext.getContext());
        umsUserService.applyForChangePassword(command);
        return SUCCESS;
    }
    
    /**
     * 自主修改用户密码
     * 
     * @param requestMsg
     * @param responseMsg
     * @return String
     */
    @RequestMapping(value = "/modifyUserPasswordByVerificationCode")
    public String modifyUserPasswordByVerificationCode(@ModelAttribute RequestMsg requestMsg, @ModelAttribute ResponseMsg responseMsg) {
    	ModifyUserPasswordByVerificationCodeCommand command = JSON.parseObject(requestMsg.getData().toString(), ModifyUserPasswordByVerificationCodeCommand.class);
        command.setCtx(CommandContext.getContext());
        umsUserService.modifyUserPasswordByVerificationCode(command);
        return SUCCESS;
    }


    /**
     * 根据客户获取(非ebay)平台账号列表
     *
     * @param requestMsg
     * @param responseMsg
     * @return String
     */
    @RequestMapping(value = "/getTeapplixInfoByCodeAndStroeType")
    public String getTeapplixInfoByCode(@ModelAttribute RequestMsg requestMsg, @ModelAttribute ResponseMsg responseMsg) {
        QueryCustomerVSAccountIdByCodeCommand command = new QueryCustomerVSAccountIdByCodeCommand();
        if(StringUtils.isNotBlank(requestMsg.getData().toString())){
            command = JSON.parseObject(requestMsg.getData().toString(), QueryCustomerVSAccountIdByCodeCommand.class);
        }
        command.setCtx(CommandContext.getContext());
        if(StringUtils.isBlank(command.getCompanyCode())){
            Bpartner bpartner = command.getCtx().get(ApiConstant.API_BPARTNER);
            command.setCompanyCode(bpartner.getValue());
        }
        List<PlatformAccountVo> customerPlatformAccountList = platformAccountService.getCustomerPlatformAccountList(command);
        Map<String,Object> date = new HashMap<String, Object>();
        date.put("PlatformAccountVoList", customerPlatformAccountList);
        responseMsg.setData(date);
        return SUCCESS;
    }



    /**
     * 根据客户获取(非ebay)平台列表
     *
     * @param requestMsg
     * @param responseMsg
     * @return String
     */
    @RequestMapping(value = "/getCustomerPlatformList")
    public String getCustomerPlatformList(@ModelAttribute RequestMsg requestMsg, @ModelAttribute ResponseMsg responseMsg) {
        QueryCustomerVSAccountIdByCodeCommand command = new QueryCustomerVSAccountIdByCodeCommand();
        if(StringUtils.isNotBlank(requestMsg.getData().toString())){
            command = JSON.parseObject(requestMsg.getData().toString(), QueryCustomerVSAccountIdByCodeCommand.class);
        }
        command.setCtx(CommandContext.getContext());
        if(StringUtils.isBlank(command.getCompanyCode())){
            Bpartner bpartner = command.getCtx().get(ApiConstant.API_BPARTNER);
            command.setCompanyCode(bpartner.getValue());
        }
        List<String> customerPlatformList = platformAccountService.getCustomerPlatformList(command);
        Map<String,Object> date = new HashMap<String, Object>();
        date.put("PlatformAccountVoList", customerPlatformList);
        responseMsg.setData(date);
        return SUCCESS;
    }


    /**
     *根据客户实时获取(非ebay)平台账号列表并更新
     *
     * @param requestMsg
     * @param responseMsg
     * @return String
     */
    @RequestMapping(value = "/geTeapplixAccountInfoListByCode")
    public String geTeapplixAccountInfoListByCode(@ModelAttribute RequestMsg requestMsg, @ModelAttribute ResponseMsg responseMsg) {
        QueryCustomerVSAccountIdByCodeCommand command = new QueryCustomerVSAccountIdByCodeCommand();
        if(StringUtils.isNotBlank(requestMsg.getData().toString())){
            command = JSON.parseObject(requestMsg.getData().toString(), QueryCustomerVSAccountIdByCodeCommand.class);
        }
        command.setCtx(CommandContext.getContext());
        if(StringUtils.isBlank(command.getCompanyCode())){
            Bpartner bpartner = command.getCtx().get(ApiConstant.API_BPARTNER);
            command.setCompanyCode(bpartner.getValue());
        }
        List<PlatformAccountVo> customerPlatformAccountList = platformAccountService.geTeapplixAccountInfoListByCode(command);
        Map<String,Object> date = new HashMap<String, Object>();
        date.put("PlatformAccountVoList", customerPlatformAccountList);
        responseMsg.setData(date);
        return SUCCESS;
    }
    /**
     * 根据客户查询所有平台账号列表信息
     * @param
     * @return
     */
    @RequestMapping(value = "/getPlatformInfo")
    public String getPlatformInfo(@ModelAttribute RequestMsg requestMsg, @ModelAttribute ResponseMsg responseMsg) {
        QueryCustomerVSAccountIdByCodeCommand command = new QueryCustomerVSAccountIdByCodeCommand();
        Searchable<?> searchable = Searchable.newSearchable();
        searchable.addSort(new Sort(Sort.Direction.DESC, "ID"));

        Object params = requestMsg.getData();
        JSONObject json = null;
        if (params instanceof JSONObject) {
            json = (JSONObject) params;
            command = JsonMapper.fromJson(json.toString(), QueryCustomerVSAccountIdByCodeCommand.class);
            int pageNo = 1, pageSize = 10; // 分页参数
            if (ValidateUtil.isExistValue(json, "pageParams")) {
                JSONObject pageParam = json.getJSONObject("pageParams");
                if (ValidateUtil.isExistValue(pageParam, "pageNo")) {
                    pageNo = pageParam.getIntValue("pageNo") == 0 ? 1 : pageParam.getIntValue("pageNo");
                }
                if (ValidateUtil.isExistValue(pageParam, "pageSize")) {
                    pageSize = pageParam.getIntValue("pageSize");
                }
            }
            searchable.setPage(pageNo, pageSize);
        } else {
            logger.info("JSON格式错误: {}", json);
            throw new ApiException(ErrorCode.ILLEGAL_JSON_STRING);
        }
        command.setCtx(CommandContext.getContext());
        if(StringUtils.isBlank(command.getCompanyCode())){
            Bpartner bpartner = command.getCtx().get(ApiConstant.API_BPARTNER);
            command.setCompanyCode(bpartner.getValue());
        }
        searchable.addSearchFilter(SearchFilterHelper.newCondition("IS_ACTIVE", SearchOperator.eq, "Y"));
        searchable.addSearchFilter(SearchFilterHelper.newCondition("IS_DELETE", SearchOperator.eq, "N"));
        if (org.apache.commons.lang.StringUtils.isNotEmpty(command.getStoreKey())) {
            searchable.addSearchFilter(SearchFilterHelper.newCondition("STOREKEY", SearchOperator.eq, command.getStoreKey()));
        }
        if (org.apache.commons.lang.StringUtils.isNotEmpty(command.getStoretype())) {
            searchable.addSearchFilter(SearchFilterHelper.newCondition("STORETYPE", SearchOperator.eq, command.getStoretype()));
        }
        if (org.apache.commons.lang.StringUtils.isNotEmpty(command.getCompanyCode())) {
            searchable.addSearchFilter(SearchFilterHelper.newCondition("CUSTOMERCODE", SearchOperator.eq, command.getCompanyCode()));
        }
        command.setSearchable(searchable);
        Page<PlatformAccountVo> customerPlatformInfo = platformAccountService.getCustomerPlatformInfo(command);

        Map<String, Object> data = new HashMap<String, Object>();
        Map<String, Object> page = new HashMap<String, Object>();
        if (null != customerPlatformInfo) {
            page.put("pageNo", customerPlatformInfo.getPageable().getPageNumber() + 1);
            page.put("pageSize", customerPlatformInfo.getPageable().getPageSize());
            page.put("totalCount", customerPlatformInfo.total);
            data.put("list", customerPlatformInfo.content);
        }
        data.put("pageParams", page);
        responseMsg.setData(data);
        return SUCCESS;
    }
}
